package com.hspedu.homework.homework03;

import com.hspedu.interface_.InterfaceExercise01.A;

/**
 * @Author Stringzhua
 * @Date 2024/3/7 14:42
 * description:
 */
public class homework03 {
    public static void main(String[] args) {
        Animal cat = new Cat();//向上转型
        cat.shout();
        Animal dog = new Dog();
        dog.shout();
    }
}

abstract class Animal {//抽象类

    public abstract void shout();
}

class Cat extends Animal {

    @Override
    public void shout() {
        System.out.println("小猫喵喵叫~");
    }
}

class Dog extends Animal {

    @Override
    public void shout() {
        System.out.println("狗会汪汪叫~");
    }
}